Skip to main content

Robotiq::Logger Class

Minimal logging surface for Robotiq components.

Abstracts logging so the SDK can be used in three contexts:

  • Production ROS 2 nodes — adapter forwards to rclcpp's logger
  • Standalone CLI / bench tools — default stderr printer (no rclcpp dep)
  • Unit tests — null logger or string capture

The interface is tiny by design: one method taking a level and a fully formatted message — formatting is the caller's concern.

Example — a custom sink
 void uartWrite(std::string_view) {} // stands in for a real UART driver
 
 class UartLogger : public Robotiq::Logger
 {
 public:
  void log(Level level, std::string_view message) override
  {
  if(level >= Level::Warn)
  {
  uartWrite("!! ");
  }
  uartWrite(message);
  }
 };
 
 void useCustomLogger()
 {
  auto logger = std::make_shared<UartLogger>();
  config.serial.port = "/dev/ttyUSB0";
  Robotiq::Gripper gripper(config, logger);
 }

Included Headers

#include <logger.hpp>

Derived Classes

classNullLogger

A do-nothing Logger, useful in tight benchmarks or tests. More...

classStderrLogger

Default Logger implementation that writes to stderr. Hosted-only: it needs <iostream> and a wall clock, neither of which a freestanding target has — provide an application Logger (e.g. a UART sink) there instead. More...

Members

Enumerations
enum classLevel { ... }

Severity of a single log line. More...

Public Destructor
~Logger ()=default
Public Member Functions
voidlog (Level level, std::string_view message)=0

Emit a fully-formatted log line. More...

Enumerations

Level

enum class Robotiq::Logger::Level
strong

Severity of a single log line.

Enumeration values
Debughigh-frequency, diagnostic detail
Infonormal operational events
Warnrecoverable, but worth a human's attention
Erroran operation failed

Public Destructor

~Logger()

virtual Robotiq::Logger::~Logger ()
virtual default

Public Member Functions

log()

virtual void Robotiq::Logger::log(Levellevel,
std::string_viewmessage
)

Emit a fully-formatted log line.

Parameters
level

Severity of this line.

message

The already-formatted text to log. The sink decides where it goes (stderr, UART, rclcpp, ...); it does not format, timestamp, or filter by level.


The documentation for this class was generated from the following file:

  • logger.hpp

Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.